<?php
/**
 * gcFramework
 *
 * Development framework for PHP 5 or newer
 *
 * @package		gcFramework
 * @author		Adam Martin
 * @copyright	Copyright (c) 2006
 * @license		http://www.gcFramework.com/web/license.html
 * @link		http://www.gcFramework.com
 * @since		Version 1.0
 */

 //instantiate class
 $db = new db;

 class db {
 	public function connect($db){
 		$connection = mysql_connect(DBHOST,DBUSER,DBPASS);
 		if(!$connection){
 			displayError(ERROR_DB_NOCONNECT);
 		}else {
 			//connect to db
 			mysql_select_db($db);
 			return $connection;
 		}
 	}

 	public function pconnect($host='localhost', $user='', $pass=''){
 		$connection = mysql_pconnect($host, $user, $pass);
 		if(!$connection){
 			displayError(ERROR_DB_NOCONNECT);
 		}else {
 			return $connection;
 		}
 	}

 	public function close($connection=''){
 		mysql_close($connection);
 	}

 	public function query($sql){
 		$result = mysql_query($sql);
 		return $result;
 	}

 	public function rowcount($resource){
 		$rowcount = mysql_num_rows($resource);
 		return $rowcount;
 	}

 	public function fetchresult($sql, $num){
 		$query = self::query($sql);
 		$result = mysql_result($query, $num);
 		return $result;
 	}
 }
?>
